﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="AddOrder.aspx.cs" Inherits="Skyworth.CRM.Web.Orders.AddOrder" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>订单信息</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=7" />
    <%--[if IE]>
     <link href="../themes/css/ieHack.css" rel="stylesheet" type="text/css" />
    <![endif]--%>

    <link href="../themes/css/Messagebox.css" rel="stylesheet" type="text/css" />
    <link href="../themes/default/style.css" rel="stylesheet" type="text/css" />
    <link href="../themes/css/core.css" rel="stylesheet" type="text/css" />
    <link href="../themes/css/pages.css" rel="stylesheet" type="text/css" />    
    <link rel="stylesheet" href="../themes/css/jquery.cluetip.css" type="text/css" />
    <script src="../javascripts/jquery-1.4.4.min.js" type="text/javascript"></script>

    <script src="../javascripts/jquery.autocomplete.js" type="text/javascript"></script>
    <script src="../javascripts/dwz.core.js" type="text/javascript"></script>
    <script src="../javascripts/json2.js" type="text/javascript"></script>
    <script src="../javascripts/dwz.pagination.js" type="text/javascript"></script>
    <script src="../javascripts/MessageBox.js" type="text/javascript"></script>    
     <script src="../javascripts/jquery.cluetip.min.js" type="text/javascript"></script>

     <style type="text/css">
        .mune_thumb
        {
            float: left;
        }
        .mune_thumb img
        {
            border: 1px solid #ccc;
            padding: 5px;
            background: #fff;
            float: left;
            height:90px;
            width:90px;
        }
        .mune_thumb ul
        {
            margin: 0;
            padding: 0;
            list-style: none;
        }
        .mune_thumb ul li
        {
           
            color: #333;
            margin: 5px;
            padding: 5px;
            background-color: #EEE;
            float: left; /*border-bottom: 1px solid #ccc;
    border-top: 1px solid #fff; width: 300px;*/
            border: 1px solid #ccc;
        }
        .mune_thumb ul li.hover
        {
            background: #e4f5ff;
            border: 1px solid #707070;
            cursor: pointer;
        }
        .mune_thumb ul li.active
        {
            background: #7CC5E5;
            border: 1px solid #707070;            
        }
        .mune_thumb ul li h4
        {
            font-size: 1.2em;
            margin: 5px 0;
            padding: 0;
        }
        .mune_thumb ul li .block
        {
            float: left;
            margin-left: 5px;
            padding: 0;
            /*width: 200px;*/
        }
        .hover
        {
            background: #CCC;
            cursor: pointer;
        }
       
    </style>
    <style type="text/css">
        .red
        {
            color: Red;
            font-weight: bold;
        }
        table.layout
        {
            border-collapse: collapse;
            border-spacing: 0;
            table-layout: fixed;
            width: 100%;
            border: solid 1px #e7e7e7;
        }
        table.layout tr td
        {
            border-bottom: solid 1px #e7e7e7;
            padding: 0px 0px;
            background-color: #EFEFEF;
        }
        table.layout td label
        {
            padding: 2px 2px;
        }
        table.layout td.left
        {
            border-right: solid 1px #e7e7e7;
            width: 110px;
        }
        table.layout td.right
        {
            background: #FFF;
        }
        table.layout td.right,table.layout td.readOnly
        {
            padding: 5px 3px;
        }
        #PopupInfo
        {
            width: 472px;
            border-top: 1px solid #ccc;
        }
        #PopupInfo li
        {
            width: 450px;
            color: #333;
            padding: 12px 10px;
            background-color: #EEE;
            float: left;
            border-bottom: 1px solid #ccc;
            border-top: 1px solid #fff;
            border-bottom: 1px solid #ccc;
            border-left: 1px solid #ccc;
            border-right: 1px solid #ccc;
        }
        #popupImg img
        {
        	border: 1px solid #ccc;
            padding: 5px;
            margin:5px;
            background: #fff;
            float: left;
            height:90px;
            width:90px;
        }
         #layout input[type='text']
        {
            width: 180px;
        }
        #layout select
        {
            width: 185px;
            height: 20px;
        }
        .content
        {
            overflow: auto;
            border: solid 1px #CCC;
            line-height: 21px;
            background: #FFF;
            padding: 3px;
        }
    </style>

    <script type="text/javascript">
        var custId =<%=CustId %>;
        var orderId =<%=OrderId %>;
        //下一页
        function dwzPageBreak(args) {
            $("#pageNum").val(args["pageNum"]);
            $("#selectedProductID").val("");
            GetProducts();
        }
        
        function RemoveRow(obj){
            $(obj).parent("td").parent("tr").remove(); 
            CountTotalNumber();       
        }
        
        function LoadProductType(brandId,callback){
           var paramList = '{"brandId":"' + brandId + '"}';
           $.ajax({
               type: "POST",
               url: "../BasicData/Products.aspx/getProductType",
               contentType: "application/json; charset=utf-8",
               data: paramList,
               dataType: "json",
               global: false,
               success: function(data) {
                   var dataTable = jQuery.parseJSON(data.d);
                   $.each(dataTable, function(i, item) {
                       $("<option value='" + item.Id + "'>" + item.Name + "</option>").appendTo($("#ddlProuctType"));

                   });
                   if (typeof (callback) == "function") {
                       callback();
                   }
               },
               error: function(msg) { alert("发生异常，获取分类数据失败！"); }
           })
       }
       
       //设置翻页    
       function SetPager(totalRecords,totalPages) {          
           $("#pageMsg").text("  共【" + totalRecords + "】条，【" + totalPages + "】页");
           $("div.pagination").each(function() {
               var $this = $(this);
               $this.pagination({
                   targetType: $this.attr("targetType"),
                   totalCount: totalRecords,
                   numPerPage: $("#numPerPageSelect").val(),
                   pageNumShown: $this.attr("pageNumShown"),
                   currentPage: $("#pageNum").val()
               });
           });
       }
       
       function GetProducts() {
           var paramList = '{"brandId":"' + $("#ddlBrand").val() + '","productName":"' + $("#txtProductName").val() + '","productTypeId":"' + $("#ddlProuctType").val() + '","orderField":"","orderValue":"","pageIndex":"' + $("#pageNum").val() + '","pagePerSize":"' + $("#numPerPageSelect").val() + '","custId":"'+custId+'","productModel":"'+$("#txtProductModel").val()+'"}';
           $.ajax({
               type: "POST",
               url: "AddOrder.aspx/GetProductsWithPrice",
               contentType: "application/json; charset=utf-8",
               data: paramList,
               dataType: "json",
               success: function(data) {
                   var dataTable = jQuery.parseJSON(data.d);
                   //填充数据
                   $("div.mune_thumb").empty();
                   var lists = "<ul>";
                   $.each(dataTable.rows, function(i, item) {
                   lists = lists + "<li rel='" + item.ProductId + "'><img src='..\/ProductImages\/Thumbnail\/" + item.Thumbnail1 + "' alt='产品图片' rel='../BasicData/ProductInfo.aspx?id="+item.ProductId +"' /><div class='block'><h4>" 
                       + item.ProductName + "</h4><p>产品单位：<span>"
                       + item.ProductUnit + "</span></p><p>产品体积：<span>"
                       + item.unitVolume+ "</span></p><p >税率：<span>"
                       + item.TaxRatio + "</span></p><p >含税单价：<span>"
                       + item.TaxPrice + "</span></p><p>不含税单价：<span>"
                       + item.Price + "</span></p><p style='display:none'>是否返利：<span>"
                       + item.SpecialType + "</span></p></div></li>";
                   })
                   lists += "</ul>";
                   $(lists).appendTo($("div.mune_thumb"));

                   //绑定事件
                   $(".mune_thumb ul li").click(function() {
                       $(this).addClass("active");
                       $(this).siblings("li").removeClass("active");
                   }).hover(function() {
                       $(this).addClass('hover');
                   }, function() {
                       $(this).removeClass('hover');
                   })
                   $(".mune_thumb ul li img").cluetip({ cluetipClass: 'jtip', width: '485px', sticky: true, activation: 'click', closePosition: 'title', arrows: true, closeText: '【关闭】' });

                   SetPager(dataTable.totalRecords,dataTable.totalPages);

               },
               error: function(msg) { $.Messager.Alert({ Title: '系统消息', Message: "发生异常，获取数据失败！", Icon: IconType.Warning }); }

           })
       
       }
        
        function BuildJson()
        {
           var rows=$("div.tableList table.list tbody tr");
           var json='[';
            rows.each(function(i,n){            
                var productName= $(this).find("td:eq(0)").text();
                var productId=$(this).find("td:eq(13)").text();
                var number=parseFloat($(this).find("td:eq(1)").text());
                if(productId!="" && productName!=""){
                    var priceType="1";//=$(this).find("td").eq(5).find("input[type='text']").eq(0).val();
                    var unitVolume=$(this).find("td:eq(5)").text();
                    var price=$(this).find("td:eq(6)").text();
                    var taxRatio=$(this).find("td:eq(7)").text();
                    var taxPrice=$(this).find("td:eq(8)").text();
                    var unit=$(this).find("td").eq(10).text();
                    var totalVolume=$(this).find("td:eq(11)").text();
                    var totalPrice=$(this).find("td:eq(2)").text();
                    var totalTaxPrice=$(this).find("td:eq(3)").text();
                    var notes=$(this).find("td:eq(12)").text();
                    notes=notes.replace(/\'/g,'').replace(/\"/g,"");
                    json+='{"ProductId":'+productId+',"ProdctName":"'+productName+'","PriceType":"'+priceType+'","UnitVolume":"'+unitVolume
                    +'","Price":"'+price+'","TaxRatio":"'+taxRatio+'","TaxPrice":"'+taxPrice+'","OrderNumber":"'+number+'","Unit":"'+unit+'","TotalVolume":"'+
                    totalVolume+'","TotalPrie":"'+totalPrice+'","TotalTaxPrice":"'+totalTaxPrice+'","Notes":"'+notes+'"}';
                   
                    json+=",";
               }                
           })
           json=json.substr(0,json.length-1);
           json+=']';           
           $("#txtOrderProducts").val(json);
        }
        function SaveCheck()
        { 
           var msg="",result=true;
           var name= $("#txtOrderName").val();
           if(name=="" || name.length<=0){  
             $("#txtOrderName").focus();
             msg="请输入订单名称！<br/>"; 
             result=false;
           }  
           var code= $("#txtOrderNo").val();
           if(code=="" || code.length<=0){  
             $("#txtOrderNo").focus();
             msg="请输入订单编号！<br/>"; 
             result=false;
           }  
            var address=$("#ddlAddress").val();
            if(address=="" || address<1){  
             $("#ddlAddress").focus();
             msg="请选择收货地址！<br/>"; 
             result=false;
           }  
                
           var linkPeople=$("#ddlLinkPeople").val();
            if(linkPeople=="" || linkPeople<1){  
             $("#ddlLinkPeople").focus();
             msg="请选择联系人！<br/>"; 
             result=false;
           }  
            var stock=$("#ddlStock").val();
            if(stock=="" || stock<1){  
             $("#ddlStock").focus();
             msg="请选择收货仓库！<br/>"; 
             result=false;
           }   
             
           var rows=$("div.tableList table.list tbody tr");           
           if(rows.length<=0){
              msg+="请选择要订购的产品!";
               result=false;
           }  
           $.Messager.Alert({ Title: '系统消息', Message: msg, Icon: IconType.Warning }); 
           return result;
        }
        
        //计算总量
        function CountTotalNumber()
        {
            var totalNumber=0,totalVolume=0,totalPrice=0;totalTaxPrice=0;
            $("div.tableList table.list tbody tr").each(function() {
                var num= parseFloat($(this).find("td").eq(1).text());
                totalNumber+=num
                totalVolume+=parseFloat($(this).find("td").eq(11).text());
                totalPrice+=parseFloat($(this).find("td").eq(2).text());
                totalTaxPrice+=parseFloat($(this).find("td").eq(3).text());
            })
            var tr=  $("div.tableList table.list tfoot tr:eq(0)");          
            tr.find("td:eq(1)").find("span").text(totalNumber.toFixed(2));
            tr.find("td:eq(5)").find("span").text(totalVolume.toFixed(2));
            tr.find("td:eq(2)").find("span").text(totalPrice.toFixed(2));
            tr.find("td:eq(3)").find("span").text(totalTaxPrice.toFixed(2));            
        }
        
        function BindAutoComplete()
        {           
            $("div.tableList table.list tbody tr").each(function() {
                var txt = $(this).find("td").eq(0).find("input[type='text']").eq(0);
                $(txt).autocomplete("../Service/OrderProduct.ashx", {
                    minChars: 1,autoFill: false,scroll: false,mustMatch: true,selectFirst: true,
                    formatItem: function(result, i, max) {
                        var item = "<span>" + result[1] + "</span>"
                        return item;
                    },
                    extraParams: {CustId: custId},
                    formatResult: function(row) { return row[1]; }
                });
                $(txt).result(function(event, data, formatted) {
                    if (data && data.length > 0) {
                        $(this).attr("disabled","disabled");
                        $(this).parents("tr").find("td").eq(6).find("input[type='text']").removeAttr("disabled").removeClass("disabled");
                        $(this).parents("tr").find("td").eq(1).find("input[type='text']").val(data[3]);
                        $(this).parents("tr").find("td").eq(2).find("input[type='text']").val(data[4]);
                        $(this).parents("tr").find("td").eq(3).find("input[type='text']").val(data[5]);
                        $(this).parents("tr").find("td").eq(4).find("input[type='text']").val(data[6]);                        
                        $(this).parents("tr").find("td").eq(5).find("input[type='text']").val(data[7]);
                        $(this).parents("tr").find("td").eq(7).find("input[type='text']").val(data[2]);
                        $(this).parents("tr").find("td").eq(13).find("input[type='text']").val(data[0]);
                    }
                });
               $(this).find("td").eq(6).find("input[type='text']").eq(0).blur(function(){
                   var count=$(this).val();
                   if(new RegExp(/^-?(?:\d+|\d{1,3}(?:,\d{3})+)(?:\.\d+)?$/).test(count)){
                       count=parseFloat(count);
                       if(!isNaN(count) && count>0){
                           var perVolume=$(this).parents("tr").find("td").eq(1).find("input[type='text']").val();
                           var perPrice= $(this).parents("tr").find("td").eq(2).find("input[type='text']").val();
                           var perTaxPrice= $(this).parents("tr").find("td").eq(4).find("input[type='text']").val();
                           var volume=count*perVolume ;
                           var price=count * perPrice;
                           var taxPrice=count *perTaxPrice;
                           $(this).parents("tr").find("td").eq(8).find("input[type='text']").val(volume);
                           $(this).parents("tr").find("td").eq(9).find("input[type='text']").val(price.toFixed(2));
                           $(this).parents("tr").find("td").eq(10).find("input[type='text']").val(taxPrice.toFixed(2));
                           CountTotalNumber();
                       }
                       else{
                           $(this).val(0);
                           $(this).parents("tr").find("td").eq(8).find("input[type='text']").val(0);
                           $(this).parents("tr").find("td").eq(9).find("input[type='text']").val(0);
                           $(this).parents("tr").find("td").eq(10).find("input[type='text']").val(0);
                       }                       
                   }
                   else{
                        $(this).val(0);
                        $(this).parents("tr").find("td").eq(8).find("input[type='text']").val(0);
                        $(this).parents("tr").find("td").eq(9).find("input[type='text']").val(0);
                        $(this).parents("tr").find("td").eq(10).find("input[type='text']").val(0); 
                   }
                
                });                
            })        
        }
        
        function SaveOrder(isSubmit){
            var methodUrl="AddOrder.aspx/CreateOrder";
            var paramList=new Object();
            paramList.orderName= $("#txtOrderName").val();
            paramList.custId=custId;
            paramList.dreeId= $("#ddlAddress").val();
            paramList.stockId= $("#ddlStock").val();//0;
            paramList.contactId= $("#ddlLinkPeople").val();
            paramList.notes= $("#txtDescription").val();
            paramList.json=$("#txtOrderProducts").val();
            paramList.totalNumber= $("#txtTotalNumber").text();
            paramList.totalVolume=$("#txtTotalVolume").text();
            paramList.totalPrice=$("#txtTotalPrice").text();
            paramList.totalTaxPrice=$("#txtTotalTaxPrice").text();
            paramList.isSubmit=isSubmit;
            paramList.orderNo=$("#txtOrderNo").val();
            if(orderId>0){
                paramList.orderId=orderId;
                methodUrl="AddOrder.aspx/UpdateOrder";
            }
           // var paramList = '{"orderName":"' + $("#txtOrderName").val() + '","custId":"' + custId + '","dreeId":"' + $("#ddlAddress").val() + '","stockId":"' + $("#ddlStock").val() + '","contactId":"' + $("#ddlLinkPeople").val() + '","notes":"' + $("#txtDescription").val() + '"}';
            $.ajax({
                type: "POST",
                url:methodUrl ,
                contentType: "application/json; charset=utf-8",
                data:JSON.stringify(paramList),
                dataType: "json",
                success: function(data) {
                   if(orderId<=0){
                       // $("#txtOrderNo").text(data.d);
                        $("#txtOrderName").val("");
                        $.Messager.Alert({ Title: '系统消息', Message: "订单保存成功！", Icon: IconType.Warning }); 
                                                 
                    }
                    else{
                        if(data.d)                          
                           $.Messager.Alert({ Title: '系统消息', Message: "修改订单成功!", Icon: IconType.Warning }); 
                    }
                    //parent.navTab.openTab("dlg_page17", "../Orders/MyOrders.aspx", { title: "我的订单", isIframe: true });
                },
                error: function(jqXHR) {var error = jQuery.parseJSON(jqXHR.responseText );$.Messager.Alert({ Title: '系统消息', Message: "发生异常，保存订单失败！<br/><br/>"+error.Message, Icon: IconType.Warning }); },
                beforeSend: function(){$("#LoadingPanel").fadeIn("slow");},
                complete: function(){$("#LoadingPanel").fadeOut("fast");}
            })  
        
        }
        
        function CheckOrder()
        {
            var selectedProductLength = $(".mune_thumb ul li.active").length;
           if (selectedProductLength <= 0) {             
               $.Messager.Alert({ Title: '系统消息', Message: "请选择要订购的产品！", Icon: IconType.Warning });
               return false;
           }
           var price=$(".mune_thumb ul li.active:eq(0)").find("div.block:eq(0)").find("p:eq(3)").find("span:eq(0)").text();
           price=parseFloat(price);
           if(!price || isNaN(price) || price<=0)
           {
               $.Messager.Alert({ Title: '系统消息', Message: "该产品缺少价格信息,请联系系统管理员！", Icon: IconType.Warning });
               return false;
           }
           var num=$("#txtCount").val();
           if( num=="" || !new RegExp(/^-?(?:\d+|\d{1,3}(?:,\d{3})+)(?:\.\d+)?$/).test(num))
           {
               $.Messager.Alert({ Title: '系统消息', Message: "请输入要订购的数量！", Icon: IconType.Warning });
               return false;
           } 
           return true;          
        }
        
        function AddToCart()
        {
           var product=$(".mune_thumb ul li.active:eq(0)");
           var productId=$(product).attr("rel");
            product=$(".mune_thumb ul li.active:eq(0)").find("div.block:eq(0)");
           var productName=$(product).find("h4:eq(0)").text();
           var unit=$(product).find("p:eq(0)").find("span:eq(0)").text();
           var unitVolume=$(product).find("p:eq(1)").find("span:eq(0)").text();
           var taxRatio=$(product).find("p:eq(2)").find("span:eq(0)").text();
           var price=$(product).find("p:eq(3)").find("span:eq(0)").text();
           var taxprice=$(product).find("p:eq(4)").find("span:eq(0)").text();
           var isFanli=$(product).find("p:eq(5)").find("span:eq(0)").text();
           var num=$("#txtCount").val();
           var totalPrice=0,totalTaxPrice=0,totalVolume=0;
          if(unitVolume.toLowerCase()=="null" || isNaN(unitVolume))
           {
                unitVolume=0;
           }
           num=parseFloat(num);
           if(!isNaN(num) && num>0){
             totalPrice=num * parseFloat(price);
             totalTaxPrice=num * parseFloat(taxprice);
             totalVolume=num*parseFloat(unitVolume);
           }
            if(isNaN(totalPrice))
           {
                totalPrice=0;
           }
           if(isNaN(totalTaxPrice))
           {
                totalTaxPrice=0;
           }
           if(isNaN(totalVolume))
           {
                totalVolume=0;
           }
           var newRow='<tr><td>'+productName+'</td><td>'+num+'</td>'+
                       '<td>'+totalTaxPrice.toFixed(2)+'</td><td>'+totalPrice.toFixed(2)+'</td>'+
                       '<td><a href="javascript:void(0)" onclick="RemoveRow(this)">移除</a></td><td style="display: none;">'+unitVolume+'</td>'+
                       '<td style="display: none;">'+price+'</td><td style="display: none;">'+taxRatio+'</td>'+
                       '<td style="display: none;">'+taxprice+'</td><td style="display: none;">'+isFanli+'</td>'+
                       '<td style="display: none;">'+unit+'</td><td style="display: none;">'+totalVolume.toFixed(2)+'</td>'+
                       '<td style="display: none;"></td>'+
                       '<td style="display: none;">'+productId+'</td></tr>';
            $("div.tableList table.list tbody").append($(newRow));  
            $("#txtCount").val("");
        }
        
        $(document).ready(function(){  
            
            GetProducts();
            
            $("#btnSearch").click(function() {
               GetProducts();
               return false;
           })
           // init styles
           $("input[type=text]").addClass("textInput").focusClass("focus");
           $("div.button").hover(function() { $(this).addClass("buttonHover"); },
                                 function() { $(this).removeClass("buttonHover"); });
            $("div.buttonActive").hover(function() { $(this).addClass("buttonActiveHover"); },
                                function() { $(this).removeClass("buttonActiveHover"); }) 
                                
           $("#btnAddToCart").click(function(){                  
              if( CheckOrder()){
                AddToCart();
                CountTotalNumber();
              }
           })
           
           $("#numPerPageSelect").change(function() {
               $("#pageNum").val(1);
               $("#selectedProductID").val("");
               GetProducts();
           })
           
            $("#ddlBrand").change(function() {
               $("#ddlProuctType option[value!='-1']").remove();
               $("#txtProductTypeId").val("-1");
               if ($(this).val() != "-1") {
                   LoadProductType($("#ddlBrand").val());
               }
           })
            
            $("#btnSave").click(function(){
                if( SaveCheck()){                 
                    BuildJson();
                    $.Messager.Confirm({ Title: '系统警告', Message: '保存之前请检查订单数据，你确定要保存该订单吗？', Icon: IconType.Question,
                            Oncallback: function(IsYes, Id) {
                                if (IsYes) { SaveOrder(false);}
                            }
                    })
                }
                return false;
            }) 
            
            $("#btnSaveAndSubmit").click(function(){
               if( SaveCheck()){                 
                    BuildJson();
                    $.Messager.Confirm({ Title: '系统警告', Message: '提交订单后，在未被处理之前，你将不能操作改订单。你确定要保存并提交该订单吗？', Icon: IconType.Question,
                            Oncallback: function(IsYes, Id) {
                                if (IsYes) { SaveOrder(true);}
                            }
                    })
                }
                return false;              
            })  
                   
        })
    
    </script>

</head>
<body style="text-align: left; background-color: White;overflow:visible">
    <div style="height:100%; width:100%">
    <form id="form1" runat="server">    
        <div style="float: left; width:68%;">
            <div style="margin: 1px;">               
                    <table width="100%" class="layout">
                        <tr>
                            <td style="padding: 4px 5px;background-color: #EEF4F5;border-color: #B8D0D6;">
                               
                                    <ul>
                                        <li style="float: left;"><span>产品名称：</span>
                                            <asp:TextBox ID="txtProductName" runat="server" CssClass="textInput"></asp:TextBox>
                                        </li>
                                        <li style="float: left; padding-left: 10px;"><span>规格型号：</span>
                                            <asp:TextBox ID="txtProductModel" runat="server" CssClass="textInput"></asp:TextBox>
                                        </li>
                                        <li style="clear: both" ></li>
                                        </ul>
                                    <ul style="margin-top:5px">
                                        <li style="float: left;"><span>所属品牌：</span>
                                            <asp:DropDownList ID="ddlBrand" DataTextField="BrandName" DataValueField="BrandId"
                                                runat="server" Style="height: 22px; line-height: 22px;width:140px;" AppendDataBoundItems="True">                                                
                                            </asp:DropDownList>
                                        </li>
                                        <li style="float: left; padding-left: 10px;"><span>所属分类：</span>
                                            <select id="ddlProuctType" style="height: 22px; line-height: 22px;width:140px;">
                                                <option value="-1">【请选择分类】</option>
                                            </select>
                                        </li>
                                        <li style="float: left; padding-left: 20px">
                                            <div class="buttonActive">
                                                <div class="buttonContent">
                                                    <asp:Button ID="btnSearch" runat="server" Text="查询" ToolTip="查询产品信息" CssClass="serverButton" />
                                                </div>
                                            </div>
                                        </li>
                                        <li style="clear: both; float:none;display:none;" ></li>
                                    </ul>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <div style="_margin-top: -2px; background-color: #ffffff">
                                    <div class="mune_thumb" >
                                        <asp:Literal ID="productsBody" runat="server"></asp:Literal>
                                        <br style="clear: both;" />
                                    </div>
                                     <br style="clear: both;" />
                                    <div class="panelBar">
                                        <div class="pages">
                                            <span>每页显示</span>
                                            <div style="float: left">
                                                <select id="numPerPageSelect" runat="server">
                                                    <option>1</option>
                                                    <option>2</option>
                                                    <option>15</option>
                                                    <option>20</option>
                                                    <option>25</option>
                                                    <option selected="selected">30</option>
                                                    <option>35</option>
                                                    <option>40</option>
                                                    <option>45</option>
                                                    <option>50</option>
                                                </select>
                                            </div>
                                            <span id="pageMsg"></span>
                                        </div>
                                        <div class="pagination" targettype="navTab" pagenumshown="10">
                                        </div>
                                    </div>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <input type="hidden" id="pageNum" name="pageNum" value="1" runat="server" />
                                <input type="hidden" id="orderField" name="orderField" value="ProductName" runat="server" />
                                <input type="hidden" id="orderValue" name="orderValue" value="asc" runat="server" />
                                <input type="hidden" id="txtProductTypeId" name="txtProductTypeId" value="-1" runat="server" />
                            </td>
                        </tr>
                    </table>
             </div>
        </div>
        <div style="float: right; width:32%">
            <div style="margin: 1px;">
                <div class="panel">
                    <div class="panelHeader">
                        <div class="panelHeaderContent">
                            <h1>
                                【订单信息】</h1>
                            <a href="javascript:void(0)" class="collapsable"></a>
                        </div>
                    </div>
                    <div class="panelContent">
                        <div class="content">
                            <table width="100%" class="layout" id="layout">
                                <tr>
                                    <td class="left">
                                        <label for="txtTotalMoney">
                                            当前账户金额(元)：</label>
                                    </td>
                                    <td class="right">
                                        <asp:Label ID="txtTotalMoney" runat="server" CssClass="red" Text="0.00"></asp:Label>
                                    </td>
                                </tr>
                                <tr>
                                    <td class="left">
                                        <label for="txtCredit">
                                            当前信用额度(元)：</label>
                                    </td>
                                    <td class="right">
                                        <asp:Label ID="txtCredit" runat="server" CssClass="red" Text="0.00"></asp:Label>
                                    </td>
                                </tr>
                                <tr>
                                    <td class="left">
                                        <label for="txtCashAmount">
                                            当前现款额度(元)：</label>
                                    </td>
                                    <td class="right">
                                        <asp:Label ID="txtCashAmount" runat="server" CssClass="red" Text="0.00"></asp:Label>
                                    </td>
                                </tr>
                                 <tr>
                                    <td class="left">
                                        <label for="txtDescription">
                                            订单编号：</label>
                                    </td>
                                    <td class="right">
                                        <asp:TextBox ID="txtOrderNo" runat="server"></asp:TextBox><em class="red">*</em>
                                        <%--<asp:Label ID="" runat="server" CssClass="red" Text="自动生成"></asp:Label>--%>
                                    </td>
                                </tr>
                                <tr>
                                    <td class="left">
                                        <label for="txtOrderName">
                                            订单名称：</label>
                                    </td>
                                    <td class="right">
                                        <asp:TextBox ID="txtOrderName" runat="server"></asp:TextBox><em class="red">*</em>
                                    </td>
                                </tr>
                                <tr>
                                    <td class="left">
                                        <label for="ddlAddress">
                                            收货地址：</label>
                                    </td>
                                    <td class="right">
                                        <asp:DropDownList ID="ddlAddress" runat="server" DataTextField="FdreeName" DataValueField="Fitemid">
                                        </asp:DropDownList>
                                        <em class="red">*</em>
                                    </td>
                                </tr>
                                <tr>
                                    <td class="left">
                                        <label for="ddlLinkPeople">
                                            联系人：</label>
                                    </td>
                                    <td class="right">
                                        <asp:DropDownList ID="ddlLinkPeople" runat="server" DataTextField="Fname" DataValueField="Fitemid">
                                        </asp:DropDownList>
                                        <em class="red">*</em>
                                    </td>
                                </tr>
                                <tr>
                                    <td class="left">
                                        <label for="ddlStock">
                                            收货仓库：</label>
                                    </td>
                                    <td class="right">
                                        <asp:DropDownList ID="ddlStock" runat="server" DataTextField="Fname" DataValueField="Fitemid">
                                        </asp:DropDownList>
                                        <em class="red">*</em>
                                    </td>
                                </tr>
                                <tr>
                                    <td class="left">
                                        <label for="txtDescription">
                                            说明：</label>
                                    </td>
                                    <td class="right">
                                        <asp:TextBox ID="txtDescription" runat="server" MaxLength="150" TextMode="MultiLine"
                                            Width="180px" Height="42px"></asp:TextBox>
                                    </td>
                                </tr>
                               
                            </table>
                        </div>
                    </div>
                    <div class="panelFooter">
                        <div class="panelFooterContent">
                        </div>
                    </div>
                </div>
            </div>
            <div style="margin: 5px 1px 5px 1px;">
                <div class="panel">
                    <div class="panelBar" style="padding: 4px 5px;" >
                        <ul>
                            <li style="float: left;"><span>订购数量:</span>
                                <input type="text" id="txtCount" name="txtCount" class="textInput" />
                            </li>
                            <li><a title="订购" href="javascript:void(0)" class="button" id="btnAddToCart" style="float: right">
                                <span>订购</span></a> </li>
                        </ul>
                    </div>
                </div>
            </div>
            <div style="margin: 1px;">
                <div class="panel">
                    <div class="panelHeader">
                        <div class="panelHeaderContent">
                            <h1>
                                【订购的产品】</h1>
                            <a class="collapsable" href="javascript:void(0)"></a>
                        </div>
                    </div>
                    <div class="panelContent">
                        <div class="content">
                            <div class="tableList">
                                <table class="list" width="100%" id="orderProductTable">
                                    <thead>
                                        <tr>
                                            <th valign="middle">
                                                <span>产品名称</span>
                                            </th>
                                            <th valign="middle">
                                                <span>数量</span>
                                            </th>
                                            <th valign="middle">
                                                <span>不含税金额</span>
                                            </th>
                                            <th valign="middle">
                                                <span>含税金额</span>
                                            </th>
                                            <th valign="middle">
                                                <span>移除</span>
                                            </th>
                                            <th valign="middle" style="display: none;">
                                                <span>单位体积</span>
                                            </th>
                                            <th valign="middle" style="display: none;">
                                                <span>不含税单价</span>
                                            </th>
                                            <th valign="middle" style="display: none;">
                                                <span>税率</span>
                                            </th>
                                            <th valign="middle" style="display: none;">
                                                <span>含税单价</span>
                                            </th>
                                            <th valign="middle" style="display: none;">
                                                <span>计入返利</span>
                                            </th>
                                            <th valign="middle" style="display: none;">
                                                <span>单位</span>
                                            </th>
                                            <th valign="middle" style="display: none;">
                                                <span>总体积</span>
                                            </th>
                                            <th valign="middle" style="display: none;">
                                                <span>备注</span>
                                            </th>
                                            <th valign="middle" style="display: none">
                                                <span>产品ID</span>
                                            </th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <asp:Literal ID="orderDetailBody" runat="server"></asp:Literal>                                       
                                    </tbody>
                                    <tfoot>
                                        <tr>
                                            <td>
                                                合计：
                                                <asp:HiddenField ID="txtOrderProducts" runat="server" />
                                            </td>
                                            <td class="red">
                                                <asp:Label ID="txtTotalNumber" runat="server"></asp:Label>
                                            </td>
                                            <td class="red">
                                                <asp:Label ID="txtTotalPrice" runat="server"></asp:Label>
                                            </td>
                                            <td class="red">
                                                <asp:Label ID="txtTotalTaxPrice" runat="server"></asp:Label>
                                            </td>
                                            <td></td>
                                            <td style="display:none">
                                            <asp:Label ID="txtTotalVolume" runat="server"></asp:Label>
                                            </td>
                                            <td style="display:none" colspan="8"></td>                                            
                                        </tr>                                       
                                    </tfoot>
                                </table>
                            </div>
                        </div>
                    </div>
                    <div class="panelFooter">
                        <div class="panelFooterContent">
                        </div>
                    </div>
                </div>
            </div>
            <div style="margin: 5px 1px 5px 1px;">
                <div class="panel">
                    <div class="panelBar" style="padding: 4px 5px;" >
                        <a title="清空" href="javascript:void(0)" class="button" style="float: left" id="A1"><span>
                            关闭</span></a>
                        
                        <div class="button" style="float: right; margin-right: 5px;">
                            <div class="buttonContent">
                                <button type="button" id="btnSaveAndSubmit">
                                    保存并提交</button>
                            </div>
                        </div>
                        <div class="button" style="float: right; margin-right: 5px;">
                            <div class="buttonContent">
                                <button type="button" id="btnSave">
                                    保存</button>
                            </div>
                        </div>
                        <div style="clear: both; float: none; display: none;">
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <br style="clear:both"/>     
    </form>
     </div>  
    <div id="LoadingPanel" style="display: none;">
        <div id='background' class='background'>
        </div>
        <div id='progressBar' class='progressBar'>
            数据加载中，请稍等...</div>
    </div>
</body>
</html>
